<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<style type="text/css">
#loginUser_dlg{
	padding:10px 20px;
}
#loginUser_form table{
	width:100%;
	border-collapse:collapse;
	border-right:1px solid #A9A9A9;
}
#loginUser_form th{
	border-left:1px solid #A9A9A9;
	border-top:1px solid #A9A9A9;
	border-bottom:1px solid #A9A9A9;
	border-right:1px solid #D3D3D3;
	padding-left:10px;
	padding-right:10px;
	text-align:right;
}
#loginUser_form td{
	border-top:1px solid #A9A9A9;
	border-bottom:1px solid #A9A9A9;
	padding-top:5px;
	padding-bottom:5px;
	padding-left:5px;
	text-align:left;
}
</style>

<script type="text/javascript">
var loginUserTable = 'loginUser';
var loginUserQuery;
var wysiwye = false;	// what you see is what you export

$(function() {
	var query = {
		"order": [
			{
				"field":"userId",
				"sort":"desc"
			}		]
	};

	initDataGrid('#loginUser_grid', appName + 'search/' + loginUserTable + '.json?init=' + JSON.stringify(query));
	loginUserQuery = '';

	initUploadFileForm($('#loginUser_file_form'), $('#loginUser_columnMap'), $('#loginUser_grid'), wysiwye);
});


/**
 * 查询
 */
function searchLoginUser() {
	loginUserQuery = getLoginUserQueryJson();
	searchDataGrid('#loginUser_grid', loginUserQuery);
}

/**
 * 查询条件
 */
function getLoginUserQueryJson(){
	var query = {
			"items":[
			    {
					"field": "email",
					"operator": "like",
					"value": $('#loginUser_email').val()
				},		    {
					"field": "userName",
					"operator": "like",
					"value": $('#loginUser_userName').val()
				},		    {
					"field": "birthday",
					"operator": "between",
					"type": "date",
					"value": [
						$('#loginUser_birthday_from').datebox('getValue'),
						$('#loginUser_birthday_to').datebox('getValue')
					]
				},		    {
					"field": "visitCount",
					"operator": "like",
					"value": $('#loginUser_visitCount').val()
				},		    {
					"field": "qq",
					"operator": "like",
					"value": $('#loginUser_qq').val()
				},		    {
					"field": "mobilePhone",
					"operator": "like",
					"value": $('#loginUser_mobilePhone').val()
				}		],
			"order": [
				{
					"field":"userId",
					"sort":"desc"
				}		]
		}

		return query;
}

/**
 * 刷新
 */
//function refreshLoginUser() {
//	refreshDataGrid('#loginUser_grid');
//}

/** 
 * 添加
 */
function addLoginUserItem(){
	showAddDialog('#loginUser_form', '#loginUser_dlg');
 
	// 设置每一个radio最后一项选中
	$('#loginUser_form').children().find(':radio').each(function(){
		$(this).prop('checked', true);
	});
	
	$('#loginUser_save').unbind('click');
	$('#loginUser_save').click(function(){
	 	var valid = true;
	 	/* 如果要进行数据重复校验，在这里添检查ajax调用
	 	 * 以下例子用来检查单个字段是否重复
	 	 */
	 	//valid = checkExistence(loginUserTable, '数据已存在', <fieldName>, $('#loginUser_<fieldName>_input').val());
	 	
	 	if(valid){
			
	 		$('#loginUser_id_input').numberbox('setValue', '0');
			saveItem({jgridId:'#loginUser_grid', jformId:'#loginUser_form', jdlgId:'#loginUser_dlg', table:loginUserTable, callback:null});
	 	}
 	});
}

/**
 * 编辑
 */
function editLoginUserItem(){
	var flag = showEditDialog('#loginUser_grid', '#loginUser_form', '#loginUser_dlg');
 
	if(flag){
	 	var valid = true;
	 	/* 如果要进行数据重复校验，在这里添检查ajax调用
	 	 * 以下例子用来检查单个字段是否重复
	 	 */
	 	//valid = checkExistence(loginUserTable, '数据已存在', <fieldName>, $('#loginUser_<fieldName>_input').val());
	 	
	 	if(valid){
			$('#loginUser_save').unbind('click');
			$('#loginUser_save').click(function(){
				saveItem({jgridId:'#loginUser_grid', jformId:'#loginUser_form', jdlgId:'#loginUser_dlg', table:loginUserTable, callback:null});
			});
	 	}
	}
}

/**
 * 复制
 */
function copyLoginUserItem(){
	var flag = showCopyDialog('#loginUser_grid', '#loginUser_form', '#loginUser_dlg');
	
	if(flag){
 		/* 在这里重设需要初始化的字段 */
 		// 默认清空自增主键
		_.each(['userId'], function(element){
			$('#loginUser_form').children().find('input[name="' + element + '"]').each(function(){
				$(this).val('');
			});
		});
		

		$('#loginUser_save').unbind('click');
		$('#loginUser_save').click(function(){
		 	var valid = true;
		 	/* 如果要进行数据重复校验，在这里添检查ajax调用
		 	 * 以下例子用来检查单个字段是否重复
		 	 */
		 	//valid = checkExistence(loginUserTable, '数据已存在', <fieldName>, $('#loginUser_<fieldName>_input').val());
		 	
		 	if(valid){
		 		$('#loginUser_id_input').numberbox('setValue', '0');
		 		saveItem({jgridId:'#loginUser_grid', jformId:'#loginUser_form', jdlgId:'#loginUser_dlg', table:loginUserTable, callback:null});
		 	}
		});
	}
}



/**
 * 导出查询结果
 */
function exportLoginUserQuery(type){
	var suffix = type == 'Excel' ? 'xls' : 'csv';
	
	showConfirmMessage('是否以' + type + '格式导出查询结果?', function(r){
		if(r){
			var form = new Object();

			form.columns = getExportColumns($('#loginUser_grid'), wysiwye);
			form.table = loginUserTable;
			
			var query = loginUserQuery ? loginUserQuery : getLoginUserQueryJson();
			form.query = JSON.stringify(query);
			
			// 表格显示的名称
			form.tableDisplayName = $(jtabId).tabs('getSelected').panel('options').title;
			// 下载文件的名称
			form.fileName = $(jtabId).tabs('getSelected').panel('options').title;
			// 下载文件格式
			form.type = suffix;
			
			downloadFile(form);
		}
	});
}


function resizeLoginUser(){
	$('#loginUser_grid').datagrid('resize');
}
</script>

<table id="loginUser_grid" data-options="toolbar:'#loginUser_toolbar'">
    <thead>
        <tr>
        	<th data-options="field:'ck'" checkbox="true"></th>
			<th data-options="field:'userId',hidden:false">编号</th>
			<th data-options="field:'email',hidden:false">电子邮箱</th>
			<th data-options="field:'userName',hidden:false">登录名</th>
			<th data-options="field:'password',hidden:true">密码</th>
			<th data-options="field:'question',hidden:true">question</th>
			<th data-options="field:'answer',hidden:true">answer</th>
			<th data-options="field:'sex',hidden:true,formatter:EcShopGenderFormatter">性别</th>
			<th data-options="field:'birthday',hidden:false">生日</th>
			<th data-options="field:'userMoney',hidden:true">userMoney</th>
			<th data-options="field:'frozenMoney',hidden:true">frozenMoney</th>
			<th data-options="field:'payPoints',hidden:true">payPoints</th>
			<th data-options="field:'rankPoints',hidden:true">rankPoints</th>
			<th data-options="field:'addressId',hidden:true">addressId</th>
			<th data-options="field:'regTime',hidden:false,formatter:EcShopDateFormatter">注册时间</th>
			<th data-options="field:'lastLogin',hidden:false,formatter:EcShopDateFormatter">最后登录时间</th>
			<th data-options="field:'lastTime',hidden:true">lastTime</th>
			<th data-options="field:'lastIp',hidden:true">lastIp</th>
			<th data-options="field:'visitCount',hidden:false">登录次数</th>
			<th data-options="field:'userRank',hidden:true">userRank</th>
			<th data-options="field:'isSpecial',hidden:true">isSpecial</th>
			<th data-options="field:'ecSalt',hidden:true">ecSalt</th>
			<th data-options="field:'salt',hidden:true">salt</th>
			<th data-options="field:'parentId',hidden:true">parentId</th>
			<th data-options="field:'flag',hidden:true">状态</th>
			<th data-options="field:'alias',hidden:true">alias</th>
			<th data-options="field:'msn',hidden:true">msn</th>
			<th data-options="field:'qq',hidden:false">QQ号码</th>
			<th data-options="field:'officePhone',hidden:false">工作电话</th>
			<th data-options="field:'homePhone',hidden:false">住宅电话</th>
			<th data-options="field:'mobilePhone',hidden:false">手机号</th>
			<th data-options="field:'isValidated',hidden:true">isValidated</th>
			<th data-options="field:'creditLine',hidden:true">creditLine</th>
			<th data-options="field:'passwdQuestion',hidden:true">passwdQuestion</th>
			<th data-options="field:'passwdAnswer',hidden:true">passwdAnswer</th>
		</tr>
    </thead>
</table>

<div id="loginUser_toolbar">
	<div style="display:none">
		<form id="loginUser_file_form" enctype="multipart/form-data" method="post" action="file/import.json">
			<input id="loginUser_file" type="file" name="file" accept="" onchange="startUpload($('#loginUser_file_form'));"/>
			<input name="table" type="text" value="loginUser">
			<input id="loginUser_columnMap" name="columnMap" type="text">
			<input id="loginUser_file_submit" type="submit"/>
		</form>
		<iframe id="loginUser_file_target" name="loginUser_file_target"></iframe>
	</div>

	<div id="loginUser_querybar" title="查询条件" class="easyui-panel" data-options="collapsible:true,border:false,onCollapse:resizeLoginUser,onExpand:resizeLoginUser">
		<table>
			<tr>
				<td style="text-align:right;">电子邮箱</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					<input id="loginUser_email" style="width:100%" type="text"/>
				</td>
				<td style="text-align:right;">登录名</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					<input id="loginUser_userName" style="width:100%" type="text"/>
				</td>
				<td style="text-align:right;">生日</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					从<input id="loginUser_birthday_from" class="easyui-datebox" style="width:100px">&nbsp;到&nbsp;<input id="loginUser_birthday_to" class="easyui-datebox" style="width:100px">
				</td>
				<td style="text-align:right;">登录次数</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					<input id="loginUser_visitCount" style="width:100%" type="text"/>
				</td>
				<td style="padding-left:10px;">
					<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="searchLoginUser()">查询</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-clear" onclick="clearCriteria('#loginUser_querybar')">清空</a>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;">手机号</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					<input id="loginUser_mobilePhone" style="width:100%" type="text"/>
				</td>
				<td style="text-align:right;">qq号码</td>
				<td style="text-align:left;padding-left:0px;padding-right:10px;">
					<input id="loginUser_qq" style="width:100%" type="text"/>
				</td>
			</tr>
		</table>
	</div>

<!-- 	<div style="margin-bottom:5px">
  		<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="addLoginUserItem()">添加</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editLoginUserItem()">编辑</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-copy" plain="true" onclick="copyLoginUserItem()">复制</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-cross" plain="true" onclick="deleteItem({jgridId:'#loginUser_grid', table:loginUserTable, idField:'userId', callback:function(){}})">删除</a>
        <a href="#" class="easyui-menubutton" iconCls="icon-export" data-options="menu:'#loginUser_export'">导出</a>
        <div id="loginUser_export">
			<div data-options="iconCls:'icon-excel'" onclick="exportLoginUserQuery('Excel')">Excel</div>
			<div data-options="iconCls:'icon-csv'" onclick="exportLoginUserQuery('CSV')">CSV</div>
		</div>
        <a href="#" class="easyui-menubutton" iconCls="icon-import" data-options="menu:'#loginUser_import'">导入</a>
        <div id="loginUser_import">
			<div data-options="iconCls:'icon-excel'" onclick="selectFile('#loginUser_file', 'Excel')">Excel</div>
			<div data-options="iconCls:'icon-csv'" onclick="selectFile('#loginUser_file', 'CSV')">CSV</div>
		</div>
	</div> -->
</div>

<div id="loginUser_dlg" class="easyui-dialog" style="width:20%" data-options="shadow:false,resizable:true,closed:true" buttons="#loginUser_dlg_buttons">
     <form id="loginUser_form" method="post" novalidate>
     	<table>
				
			<tr style="display:none">
				<th style="">
					用户编号
				</th>
				<td><input id="loginUser_userId_input" style="width:95%" name="userId" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					登录名
				</th>
				<td><input id="loginUser_userName_input" style="width:95%" name="userName" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					密码
				</th>
				<td><input id="loginUser_password_input" style="width:95%" name="password" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					question
				</th>
				<td><input id="loginUser_question_input" style="width:95%" name="question" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					answer
				</th>
				<td><input id="loginUser_answer_input" style="width:95%" name="answer" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					手机号
				</th>
				<td><input id="loginUser_mobilePhone_input" style="width:95%" name="mobilePhone" class="easyui-validatebox" data-options="required:false,validType:'mobile'"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					性别
				</th>
				<td>
					<label><input id="pageDemo_gender_input1" name="gender" type="radio" value="1">男</label>
					<label><input id="pageDemo_gender_input1" name="gender" type="radio" value="2">女</label>
					<label><input id="pageDemo_gender_input1" name="gender" type="radio" value="0">保密</label>
				</td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					电子邮箱
				</th>
				<td><input id="loginUser_email_input" style="width:95%" name="email" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					生日
				</th>
				<td><input id="loginUser_birthday_input" style="width:95%" name="birthday" class="easyui-datebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					userMoney
				</th>
				<td><input id="loginUser_userMoney_input" style="width:95%" name="userMoney" class="easyui-numberbox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					frozenMoney
				</th>
				<td><input id="loginUser_frozenMoney_input" style="width:95%" name="frozenMoney" class="easyui-numberbox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					payPoints
				</th>
				<td><input id="loginUser_payPoints_input" style="width:95%" name="payPoints" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					rankPoints
				</th>
				<td><input id="loginUser_rankPoints_input" style="width:95%" name="rankPoints" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					addressId
				</th>
				<td><input id="loginUser_addressId_input" style="width:95%" name="addressId" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					注册时间
				</th>
				<td><input id="loginUser_regTime_input" style="width:95%" name="regTime" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					最后登录时间
				</th>
				<td><input id="loginUser_lastLogin_input" style="width:95%" name="lastLogin" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					lastTime
				</th>
				<td><input id="loginUser_lastTime_input" style="width:95%" name="lastTime" class="easyui-datetimebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					lastIp
				</th>
				<td><input id="loginUser_lastIp_input" style="width:95%" name="lastIp" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					登录次数
				</th>
				<td><input id="loginUser_visitCount_input" style="width:95%" name="visitCount" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					userRank
				</th>
				<td><input id="loginUser_userRank_input" style="width:95%" name="userRank" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					isSpecial
				</th>
				<td><input id="loginUser_isSpecial_input" style="width:95%" name="isSpecial" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					ecSalt
				</th>
				<td><input id="loginUser_ecSalt_input" style="width:95%" name="ecSalt" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					salt
				</th>
				<td><input id="loginUser_salt_input" style="width:95%" name="salt" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					parentId
				</th>
				<td><input id="loginUser_parentId_input" style="width:95%" name="parentId" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					状态
				</th>
				<td><input id="loginUser_flag_input" style="width:95%" name="flag" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					alias
				</th>
				<td><input id="loginUser_alias_input" style="width:95%" name="alias" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="display:none">
					msn
				</th>
				<td><input id="loginUser_msn_input" style="width:95%" name="msn" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					QQ号码
				</th>
				<td><input id="loginUser_qq_input" style="width:95%" name="qq" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					工作电话
				</th>
				<td><input id="loginUser_officePhone_input" style="width:95%" name="officePhone" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="">
				<th style="">
					住宅电话
				</th>
				<td><input id="loginUser_homePhone_input" style="width:95%" name="homePhone" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					isValidated
				</th>
				<td><input id="loginUser_isValidated_input" style="width:95%" name="isValidated" class="easyui-numberspinner" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					creditLine
				</th>
				<td><input id="loginUser_creditLine_input" style="width:95%" name="creditLine" class="easyui-numberbox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					passwdQuestion
				</th>
				<td><input id="loginUser_passwdQuestion_input" style="width:95%" name="passwdQuestion" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
				
			<tr style="display:none">
				<th style="">
					passwdAnswer
				</th>
				<td><input id="loginUser_passwdAnswer_input" style="width:95%" name="passwdAnswer" class="easyui-validatebox" data-options="required:false"></td>
				<td><span class="hint"></span></td>
		</tr>
		</table>
     </form>
 </div>
 <div id="loginUser_dlg_buttons">
     <a id="loginUser_save" href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save">保存</a>
     <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-no" onclick="closeDialog('#loginUser_dlg')">取消</a>
 </div>



